﻿@model IList<Nop.Core.Domain.Orders.Order>
<script type="text/javascript">
    //滚动插件
    (function ($) {
        $.fn.extend({
            Scroll: function (opt, callback) {
                //参数初始化
                if (!opt) var opt = {};
                var _this = this.eq(0).find("ul:first");
                var lineH = _this.find("li:first").height(),
                line = opt.line ? parseInt(opt.line, 10) : parseInt(this.height() / lineH, 10),
                speed = opt.speed ? parseInt(opt.speed, 10) : 5000,
                timer = opt.timer ? parseInt(opt.timer, 10) : 5000;
                if (line == 0) line = 1;
                var upHeight = 0 - line * lineH;
                //滚动函数
                scrollUp = function () {
                    _this.animate({
                        marginTop: upHeight
                    }, speed, function () {
                        for (i = 1; i <= line; i++) {
                            _this.find("li:first").appendTo(_this);
                        }
                        _this.css({ marginTop: 0 });
                    });
                }
                //鼠标事件绑定
                _this.hover(function () {
                    clearInterval(timerID);
                }, function () {
                    timerID = setInterval("scrollUp()", timer);
                }).mouseout();
            }
        })
    })(jQuery);

    $(document).ready(function () {
        $("#scrollDiv").Scroll({ line: 1, speed: 1000, timer: 3500 });
    });
</script>
<div class="block block-category-navigation">
    <div class="title">
        Recent Order
    </div>
    <div class="clear">
    </div>
    <div class="listbox">
        <div id="scrollDiv">
            <ul>
                @foreach (var item in Model)
                {
                    if (item != null)
                    {
                        if (item.OrderProductVariants.Count > 0)
                        {
                            <li>
                            @if (item.OrderProductVariants.First().ProductVariant.Product.Name.Length > 30)
                            {
                                
                                <a href="@Url.RouteUrl("Product", new { productId = item.OrderProductVariants.First().ProductVariant.ProductId, SeName = item.OrderProductVariants.First().ProductVariant.Product.Name.Replace(" ","-") })" target='_blank'>@item.OrderProductVariants.First().ProductVariant.Product.Name.Substring(0, 22)</a>
                                
                            }
                            else
                            {
                                <a href="@Url.RouteUrl("Product", new { productId = item.OrderProductVariants.First().ProductVariant.ProductId, SeName = item.OrderProductVariants.First().ProductVariant.Product.Name.Replace(" ", "-") })" target='_blank'>@item.OrderProductVariants.First().ProductVariant.Product.Name</a>
                            }
                            <br />ship to @if (item.BillingAddress != null)
                                          {
                                              <span>@item.BillingAddress.FirstName</span><span>,</span> <span>@item.BillingAddress.Country.Name</span>
                                          }
                                          else if (item.ShippingAddress != null)
                                          {
                                            <span>@item.ShippingAddress.FirstName </span><span>,</span> <span>@item.ShippingAddress.Country.Name</span>
                                          }
                         </li>
                        }
                    }
                }
            </ul>
                
        </div>
    </div>
</div>
